home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / comms / other / ftransapiv1.3 / arexx / ftransib.ibrx < prev    next >
Text File  |  1999-11-30  |  3KB  |  120 lines

  1. /* 
  2.  
  3.  ----------------------------------------
  4.  IBrowse Translator By FTranslator Client
  5.  
  6.  Script by Cristian Robert Gallas
  7.  
  8.  Tested with IBrowse 1.22
  9.  Usage:                                 
  10.  Use in ARexx interface of IBrowse
  11.  $VER: FTransIB.ibrx v1.0 (25.09.96)
  12.  ----------------------------------------
  13.  
  14.  HISTORY
  15.  ----------------------------------------
  16.  v0.01b [14.08.98] - First public beta version.
  17.  v1.0   [25.09.99] - Modified to FTrans 1.2 API;
  18.  ----------------------------------------
  19.  
  20.  [Steps installation]
  21.  
  22.  > Copy FTransIB.ibrx to IBROWSE:IBrx/
  23.  > Go to Preferences/General
  24.  > Select folder Rexx
  25.  > Click in ADD
  26.  > Name  -> Port->Eng (Example: Portuguese to English)
  27.  > Macro -> IBROWSE:IBrx/FTransIB.ibrx 3 (3 is a translation direction)
  28.  > Click OK
  29.  > Save preferences in Preferences/Save Settings
  30.  > Select text for translation
  31.  > Go to REXX Menu and select Port->Eng
  32.  > Wait for windows with translation :)
  33.  
  34.  0 - English   to Francais
  35.  1 - English   to Deutsch
  36.  2 - English   to Italiano
  37.  3 - English   to Portugues
  38.  4 - English   to Espanol
  39.  5 - Francais  to English
  40.  6 - Deutsch   to English
  41.  7 - Italiano  to English
  42.  8 - Espanol   to English
  43.  9 - Portugues to English
  44.  
  45. */
  46.  
  47. Options Results
  48.  
  49. tmpfile = 'Ram:FTransTmp.IB'
  50. tmpclip = 'Ram:FTransIB.Clip'
  51. sel = ''
  52.  
  53. ARG traduz
  54.  
  55. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  56. if ~show(l, "rexxsupport.library") then
  57.   if ~addlib("rexxsupport.library", 0, -30) then
  58.     exit
  59. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  60. if ~show(l, "rexxtricks.library") then
  61.   if ~addlib("rexxtricks.library", 0, -30) then
  62.     exit
  63.  
  64. saida = TestaPubScreen(pubscreenlist(screenlist))
  65.  
  66. /* TESTA SE O PROGRAMA JA NAO ESTA COM A PORTA DE TRADUCAO ABERTA */
  67. if exists(tmpfile) then do
  68.   Address Command 'echo "FTranslation port is open! Translation in progress, wait..." > "Ram:FT.echo.tmp"'
  69.   if saida = 0 then
  70.     Address Command 'Multiview PUBSCREEN IBROWSER "Ram:FT.echo.tmp"'
  71.   else
  72.     Address Command 'Multiview "Ram:FT.echo.tmp"'
  73.   call delete('Ram:FT.echo.tmp')
  74.   exit
  75. end
  76.  
  77. /* COLOCA COMO DEFAULT PORTUGUES TO ENGLISH */
  78. if traduz = "" then
  79.   traduz = 3
  80.  
  81. /* LE O CLIPBOARD */
  82. sel = ReadClipboard(0)
  83.  
  84. /* TESTA SE FOI MARCADO O TEXTO */
  85. if sel = '' then do
  86.   Address Command 'echo "You need select text first..." > 'tmpfile
  87.   if saida = 0 then
  88.     Address Command 'Multiview PUBSCREEN IBROWSER "'tmpfile'"'
  89.   else
  90.     Address Command 'Multiview "'tmpfile'"'
  91.   call delete(tmpfile)
  92.   exit
  93. end
  94.  
  95. call open(1, tmpclip, 'W')
  96. call writeln(1, sel)
  97. call close(1)
  98.  
  99. /* EXECUTA O FTRANSLATOR COM OS ARGUMENTOS DA TRADUCAO */
  100. comando = 'C:FTranslator -F "'tmpclip'" -D 'traduz' SILENCE > 'tmpfile
  101. Address Command comando
  102. call delete(tmpclip)
  103.  
  104. if saida = 0 then
  105.   Address Command 'Amigaguide PUBSCREEN IBROWSER "'tmpfile'"'
  106. else
  107.   Address Command 'Amigaguide "'tmpfile'"'
  108.  
  109. call delete(tmpfile)
  110.  
  111. exit
  112.  
  113. /* TESTA SE O IBROWSER ESTA EM UMA JANELA PUBSCREEN */
  114. TestaPubScreen:
  115. Do i = 1 To screenlist.0
  116.   if Lower(screenlist.i) = 'ibrowser' then
  117.     return 0
  118. end
  119. return 1
  120.